Limited memory access window for motion vector refinement

ABSTRACT

The present disclosure relates to motion vector refinement. As a first step, an initial motion vector and a template for the block are obtained. Then, the refinement of the initial motion vector is determined by template matching with said template in a search space. The search space is located on a position given by the initial motion vector and includes one or more fractional sample positions, wherein each of the fractional sample positions belonging to the search space is obtained by interpolation filtering with a filter of a predefined tap-size assessing integer samples only within a window, said window being formed by integer samples accessible for the template matching in said search space.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/EP2018/064247, filed on May 30, 2018, which claims priority toInternational Patent Application No. PCT/EP2017/075710, filed on Oct. 9,2017. The disclosures of the aforementioned applications are herebyincorporated by reference in their entireties.

The present invention relates to motion vector determination andrefinement which may be employed during encoding and decoding of videos.

BACKGROUND

Current hybrid video codecs employ predictive coding. A picture of avideo sequence is subdivided into blocks of pixels and these blocks arethen coded. Instead of coding a block pixel by pixel, the entire blockis predicted using already encoded pixels in the spatial or temporalproximity of the block. The encoder further processes only thedifferences between the block and its prediction. The further processingtypically includes a transformation of the block pixels intocoefficients in a transformation domain. The coefficients may then befurther compressed by means of quantization and further compacted byentropy coding to form a bitstream. The bitstream further includes anysignaling information which enables the decoder to decode the encodedvideo. For instance, the signaling may include settings concerning theencoder settings such as size of the input picture, frame rate,quantization step indication, prediction applied to the blocks of thepictures, or the like.

Temporal prediction exploits temporal correlation between pictures, alsoreferred to as frames, of a video. The temporal prediction is alsocalled inter-prediction, as it is a prediction using the dependenciesbetween (inter) different video frames. Accordingly, a block beingencoded, also referred to as a current block, is predicted from one ormore previously encoded picture(s) referred to as a referencepicture(s). A reference picture is not necessarily a picture precedingthe current picture in which the current block is located in thedisplaying order of the video sequence. The encoder may encode thepictures in a coding order different from the displaying order. As aprediction of the current block, a co-located block in a referencepicture may be determined. The co-located block is a block which islocated in the reference picture on the same position as is the currentblock in the current picture. Such prediction is accurate for motionlesspicture regions, i.e. picture regions without movement from one pictureto another.

In order to obtain a predictor which takes into account the movement,i.e. a motion compensated predictor, motion estimation is typicallyemployed when determining the prediction of the current block.Accordingly, the current block is predicted by a block in the referencepicture, which is located in a distance given by a motion vector fromthe position of the co-located block. In order to enable a decoder todetermine the same prediction of the current block, the motion vectormay be signaled in the bitstream. In order to further reduce thesignaling overhead caused by signaling the motion vector for each of theblocks, the motion vector itself may be estimated. The motion vectorestimation may be performed based on the motion vectors of theneighboring blocks in spatial and/or temporal domain.

The prediction of the current block may be computed using one referencepicture or by weighting predictions obtained from two or more referencepictures. The reference picture may be an adjacent picture, i.e. apicture immediately preceding and/or the picture immediately followingthe current picture in the display order since adjacent pictures aremost likely to be similar to the current picture. However, in general,the reference picture may be also any other picture preceding orfollowing the current picture in the displaying order and preceding thecurrent picture in the bitstream (decoding order). This may provideadvantages for instance in case of occlusions and/or non-linear movementin the video content. The reference picture identification may thus bealso signaled in the bitstream.

A special mode of the inter-prediction is a so-called bi-prediction inwhich two reference pictures are used in generating the prediction ofthe current block. In particular, two predictions determined in therespective two reference pictures are combined into a prediction signalof the current block. The bi-prediction may result in a more accurateprediction of the current block than the uni-prediction, i.e. predictiononly using a single reference picture. The more accurate predictionleads to smaller differences between the pixels of the current block andthe prediction (referred to also as “residuals”), which may be encodedmore efficiently, i.e. compressed to a shorter bitstream. In general,more than two reference pictures may be used to find respective morethan two reference blocks to predict the current block, i.e. amulti-reference inter prediction can be applied. The termmulti-reference prediction thus includes bi-prediction as well aspredictions using more than two reference pictures.

In order to provide more accurate motion estimation, the resolution ofthe reference picture may be enhanced by interpolating samples betweenpixels. Fractional pixel interpolation can be performed by weightedaveraging of the closest pixels. In case of half-pixel resolution, forinstance a bilinear interpolation is typically used. Other fractionalpixels are calculated as an average of the closest pixels weighted bythe inverse of the distance between the respective closest pixels to thepixel being predicted.

The motion vector estimation is a computationally complex task in whicha similarity is calculated between the current block and thecorresponding prediction blocks pointed to by candidate motion vectorsin the reference picture. Typically, the search region includes M×Msamples of the image and each of the sample position of the M×Mcandidate positions is tested. The test includes calculation of asimilarity measure between the N×N reference block C and a block R,located at the tested candidate position of the search region. For itssimplicity, the sum of absolute differences (SAD) is a measurefrequently used for this purpose and given by:

${{SAD}\left( {x,y} \right)} = {\sum\limits_{i = 0}^{N - 1}\; {\sum\limits_{j = 0}^{N - 1}\; {{{R_{i,j}\left( {x,y} \right)} - C_{i,j}}}}}$

In the above formula, x and y define the candidate position within thesearch region, while indices i and j denote samples within the referenceblock C and candidate block R. The candidate position is often referredto as block displacement or offset, which reflects the representation ofthe block matching as shifting of the reference block within the searchregion and calculating a similarity between the reference block C andthe overlapped portion of the search region. In order to reduce thecomplexity, the number of candidate motion vectors is usually reduced bylimiting the candidate motion vectors to a certain search space. Thesearch space may be, for instance, defined by a number and/or positionsof pixels surrounding the position in the reference picturecorresponding to the position of the current block in the current image.After calculating SAD for all M×M candidate positions x and y, the bestmatching block R is the block on the position resulting in the lowestSAD, corresponding to the largest similarity with reference block C. Onthe other hand, the candidate motion vectors may be defined by a list ofcandidate motion vectors formed by motion vectors of neighboring blocks.

Motion vectors are usually at least partially determined at the encoderside and signaled to the decoder within the coded bitstream. However,the motion vectors may also be derived at the decoder. In such case, thecurrent block is not available at the decoder and cannot be used forcalculating the similarity to the blocks to which the candidate motionvectors point in the reference picture. Therefore, instead of thecurrent block, a template is used which is constructed out of pixels ofalready decoded blocks. For instance, already decoded pixels adjacent tothe current block may be used. Such motion estimation provides anadvantage of reducing the signaling: the motion vector is derived in thesame way at both the encoder and the decoder and thus, no signaling isneeded. On the other hand, the accuracy of such motion estimation may belower.

In order to provide a tradeoff between the accuracy and signalingoverhead, the motion vector estimation may be divided into two steps:motion vector derivation and motion vector refinement. For instance, amotion vector derivation may include selection of a motion vector fromthe list of candidates. Such a selected motion vector may be furtherrefined for instance by a search within a search space. The search inthe search space is based on calculating cost function for eachcandidate motion vector, i.e. for each candidate position of block towhich the candidate motion vector points.

Document JVET-D0029: Decoder-Side Motion Vector Refinement Based onBilateral Template Matching, X. Chen, J. An, J. Zheng (the document canbe found at: http://phenix.it-sudparis.eu/jvet/ site) shows motionvector refinement in which a first motion vector in integer pixelresolution is found and further refined by a search with a half-pixelresolution in a search space around the first motion vector.

In order to perform motion vector refinement, it is necessary to storeat least those samples in the memory, which are necessary for thecurrent block to perform the refinement, i.e. the samples whichcorrespond to the search space and samples which can be accessed whentemplate matching in the search space is performed.

External memory access is an important design parameter in presenthardware architectures and/or software implementations. This is causedby the fact that the external memory access slows down the processing incomparison with the intern memory utilization. On the other hand,internal memory on chip is limited, for instance due to the chip sizeimplementation.

SUMMARY

The present disclosure is based on observation that motion vectorrefinement when implemented in combination with fractional interpolationmay require further increase of on-chip memory size or even externalmemory access. Both options may be undesirable.

In view of the above mentioned problem, the present disclosure providesmotion vector prediction which enables to take into account the numberof accesses to the external memory and the number of samples which arenecessary to be accessible for motion vector refinement of a motionvector for a coding block.

This is achieved by limiting the number of samples to those necessaryfor the integer sample template matching and only enabling thosefractional positions which are obtainable with a predeterminedinterpolation filter without requiring additional integer samples.

According to an aspect of the invention, an apparatus is provided fordetermination of a motion vector for a prediction block including aprocessing circuitry configured to: obtain an initial motion vector anda template for the prediction block; and determine a refinement of theinitial motion vector by template matching with said template in asearch space. Said search space is located on a position given by theinitial motion vector and includes one or more fractional samplepositions, wherein each of the fractional sample positions belonging tothe search space is obtained by interpolation filtering with a filter ofa predefined tap-size assessing integer samples only within a window,said window being formed by integer samples accessible for the templatematching in said search space.

One of the advantages of such motion vector determination is limitednumber of samples which need to be accessible for performing the motionvector refinement for a prediction block while at the same time limitingthe number of accesses to the external memory or generally to amemory/storage/cache storing the entire reference pictures.

In an example, the window is defined as N integer sample columns and Minteger sample rows relative to the prediction block initial motionvector, N and M being non-zero integer values. Such definition mayprovide a simple means for specifying which samples are to be retrievedfor the purpose of motion vector determination and/or refinement. It mayalso be easily configurable for instance within a bitstream or standard.

In one embodiment, the processing circuitry is configured to determinethe refinement of the initial motion vector by template matching withsaid template in a search space which is iteratively extended in adirection given by one of more best matching positions of the searchspace in a most recent iteration, and the window is defined by apredefined maximum number of the iterations.

The search space may include a rectangular sub-window of the window suchthat all integer samples accessed for interpolation filtering of eachfractional sample in the sub-window are located within said window forthe interpolation filter with the predefined tap-size.

The search space may include a rectangular search sub-window of thewindow, wherein the refinement of the initial motion vector isdetermined by template matching with said template in the rectangularsearch sub-window such that the integer samples accessed forinterpolation filtering of each fractional sample in the searchsub-window are located within said window for the interpolation filterwith the predefined tap-size.

In one implementation, the processing circuitry may be configured todetermine the refinement of the initial motion vector by templatematching with said template in a search space which is iterativelyextended in a direction given by one of more best matching positions ofthe search space in a most recent iteration, wherein the iteration isended when at least one sample within the search space of the mostrecent iteration is outside the search sub-window.

In particular, as a specific example, the interpolation filter is aone-dimensional filter assessing K either horizontal or vertical integersamples when the fractional position is located on a respectivehorizontal or vertical line of integer samples.

Moreover, for instance, the search space further includes fractionalpositions located outside the sub-window either:

-   -   adjacent on the top or on the bottom of the sub-window and        located on the horizontal line of integer samples or    -   adjacent on the left or on the right hand side of the sub-window        and located on the vertical line of integer samples.

According to another aspect of the invention, an encoding apparatus isprovided for encoding video images split to prediction blocks into abitstream, the encoding apparatus comprising: the apparatus fordetermination of a motion vector for a prediction block as describedabove; and an encoding circuitry for encoding difference between theprediction block and the predictor given by a prediction block in aposition based on the determined motion vector and for generatingbitstream including the encoded difference and the initial motionvector.

According to another aspect of the invention a decoding apparatus isprovided for decoding from a bitstream video images split to predictionblocks, the decoding apparatus comprising: a parsing unit for parsingfrom the bitstream an initial motion vector and an encoded differencebetween a prediction block and a predictor given by a prediction blockin a position specified by a refined motion vector; the apparatus fordetermination of the refined motion vector for the prediction block asdescribed above; as well as a decoding circuitry for reconstructing theprediction block as a function of the parsed difference and thepredictor given by the prediction block in the position specified by therefined motion vector. The function may be or include a sum. Thefunction may further comprise clipping, rounding, scaling or furtheroperations.

According to another aspect of the invention a method is provided fordetermination of a motion vector for a prediction block including thesteps of: obtaining an initial motion vector and a template for theprediction block; determining a refinement of the initial motion vectorby template matching with said template in a search space, wherein saidsearch space is located on a position given by the initial motion vectorand includes one or more fractional sample positions, wherein each ofthe fractional sample positions belonging to the search space isobtained by interpolation filtering with a filter of a predefinedtap-size assessing integer samples only within a window, said windowbeing formed by integer samples accessible for the template matching insaid search space.

For instance, the window is defined a as N integer sample columns and Minteger sample rows relative to the prediction block initial motionvector, N and M being non-zero integer values.

In an embodiment, the refinement of the initial motion vector isdetermined by template matching with said template in a search spacewhich is iteratively extended in a direction given by one of more bestmatching positions of the search space in a most recent iteration, thewindow is defined by a predefined maximum number of the iterations.

In an exemplary implementation, the search space includes a rectangularsub-window of the window such that all integer samples accessed forinterpolation filtering of each fractional sample in the sub-window arelocated within said window for the interpolation filter with thepredefined tap-size.

The search space may include a rectangular search sub-window of thewindow, wherein the refinement of the initial motion vector isdetermined by template matching with said template in the rectangularsearch sub-window such that the integer samples accessed forinterpolation filtering of each fractional sample in the searchsub-window are located within said window for the interpolation filterwith the predefined tap-size.

In one implementation, the refinement of the initial motion vector maybe determined by template matching with said template in a search spacewhich is iteratively extended in a direction given by one of more bestmatching positions of the search space in a most recent iteration,wherein the iteration is ended when at least one sample within thesearch space of the most recent iteration is outside the searchsub-window.

Moreover, for instance, the interpolation filter is a one-dimensionalfilter assessing K either horizontal or vertical integer samples whenthe fractional position is located on a respective horizontal orvertical line of integer samples.

Advantageously, the search space further includes fractional positionslocated outside the sub-window either: adjacent on the top or on thebottom of the sub-window and located on the horizontal line of integersamples or adjacent on the left or on the right hand side of thesub-window and located on the vertical line of integer samples.

According to another aspect of the invention an encoding method isprovided for encoding video images split to prediction blocks into abitstream, the encoding method comprising the steps of determining amotion vector for a prediction block according to any of methodsdescribed above; as well as encoding difference between the predictionblock and the predictor given by a prediction block in a position basedon the determined motion vector and for generating bitstream includingthe encoded difference and the initial motion vector.

According to another aspect of the invention a decoding method isprovided for decoding from a bitstream video images split to predictionblocks, the decoding method comprising: parsing from the bitstream aninitial motion vector and an encoded difference between a predictionblock and a predictor given by a prediction block in a positionspecified by a refined motion vector; determining the refined motionvector for the prediction block according to any of methods mentionedabove; and reconstructing the prediction block as a sum of the parseddifference and the predictor given by the prediction block in theposition specified by the refined motion vector.

According to an aspect of the invention a non-transitorycomputer-readable storage medium is provided storing instructions whichwhen executed by a processor/processing circuitry perform the stepsaccording to any of the above aspects or embodiments or theircombinations.

BRIEF DESCRIPTION OF THE DRAWINGS

In the following exemplary embodiments are described in more detail withreference to the attached figures and drawings, in which:

FIG. 1 is a block diagram showing an exemplary structure of an encoderin which the motion vector derivation and refinement may be employed;

FIG. 2 is a block diagram showing an exemplary structure of a decoder inwhich the motion vector derivation and refinement may be employed;

FIG. 3 is a schematic drawing illustrating an exemplary templatematching suitable for bi-prediction;

FIG. 4 is a schematic drawing illustrating an exemplary templatematching suitable for uni- and bi-prediction;

FIG. 5 is a block diagram illustrating stages of motion vectorderivation operating without providing initial motion vectors to berefined in the bitstream;

FIG. 6 is a block diagram illustrating an exemplary hardware toimplement an embodiment of the invention;

FIG. 7 is a schematic drawing illustrating for a coding block anexemplary window with samples which should be available to be accessed;

FIG. 8 is a schematic drawing illustrating iterative search space;

FIG. 9 is a schematic drawing illustrating extension of the memoryaccess window in horizontal direction due to interpolation filtering;

FIG. 10 is a schematic drawing illustrating definition of a sub-windowfor fractional sample positions;

FIG. 11 is a schematic drawing illustrating an exemplary definition ofthe memory access window;

FIG. 12 is a schematic drawing illustrating exemplary positionsincluding fractional positions which are allowed to form search spacepositions for motion vector refinement;

FIG. 13 is a schematic drawing illustrating exemplary fractionalpositions which are not allowed to form search space positions formotion vector refinement;

FIG. 14 is a flow diagram illustrating method for determining whichposition of a search space are allowed to be tested by template matchingfor motion vector refinement;

FIG. 15 is a schematic drawing illustrating exemplary positionsincluding fractional positions which are allowed to form search spacepositions for motion vector refinement;

FIG. 16 is a flow diagram illustrating an iterative refinement processin a memory access window; and

FIG. 17 is a flow diagram illustrating an iterative refinement processin a search sub-window.

DETAILED DESCRIPTION

The present disclosure relates to adjustment of the number of sampleswhich are to be accessible to perform motion vector refinement andinterpolation in order to obtain fractional positions in a referencepicture.

As mentioned above, the external memory access is one of the mostimportant design considerations in today's hardware and softwarearchitectures. Motion vector estimation especially when includingtemplate matching, for instance in case of motion vector refinement, mayalso be used with interpolation filtering to obtain fractional positionsof the search space. Use of the interpolation filtering may requireincrease of the number of samples which need to be accessed from thememory. However, this may lead to either increase of the expensiveon-chip memory or to increased number of external memory accesses, whichon the other hand slows down the implementation. Especially at thedecoder side, these problems may lead to more expensive or slowerapplications which is not desirable.

In order to prevent such situation, the present disclosure provides arestriction on external memory accesses. According to an embodiment ofthe invention, a window of samples which are to be accessible for themotion vector refinement is defined around the position pointed to by anon-refined motion vector, i.e. by the initial motion vector. The windowdefines the maximum number of samples that need to be accessed from thememory in order to perform the motion vector refinement. In general, thesamples which are to be accessible include the samples on positions ofthe search space in which the template matching is to be performed andthe samples which are to be matched with the template for all positionsin the search space. The latter typically exceed the search space. Forsimplicity reasons the window of memory access may be defined as anextension around the coding block (current block for which the motionvector is to be found). For example, R samples from left and right and Rsamples from top and bottom boundary of the current block may define thewindow. In other words, when the current block has a size of N×Nsamples, the access window may have size of (R+N+R)×(R+N+R), i.e.(N+2R)×(N+2R) samples For instance, R may be equal to 4. However, thecurrent block may be of vertical size N different from the horizontalsize N and the number of extension samples in top, bottom, left andright direction may also differ. According to the present disclosure, inorder to limit the memory access window, the fractional pixelcoordinates are accessed by the motion vector refinement only if samplesnecessary for the interpolation lie inside the window of memory accessfor the motion vector refinement as defined for integer samples.

FIG. 1 shows an encoder 100 which comprises an input for receiving inputimage samples of frames or pictures of a video stream and an output forgenerating an encoded video bitstream. The term “frame” in thisdisclosure is used as a synonym for picture. However, it is noted thatthe present disclosure is also applicable to fields in case interlacingis applied. In general, a picture includes m times n pixels. Thiscorresponds to image samples and may comprise one or more colorcomponents. For the sake of simplicity, the following description refersto pixels meaning samples of luminance. However, it is noted that themotion vector search of the invention can be applied to any colorcomponent including chrominance or components of a search space such asRGB or the like. On the other hand, it may be beneficial to only performmotion vector estimation for one component and to apply the determinedmotion vector to more (or all) components.

The input blocks to be coded do not necessarily have the same size. Onepicture may include blocks of different sizes and the block raster ofdifferent pictures may also differ.

In an explicative realization, the encoder 100 is configured to applyprediction, transformation, quantization, and entropy coding to thevideo stream. The transformation, quantization, and entropy coding arecarried out respectively by a transform unit 106, a quantization unit108 and an entropy encoding unit 170 so as to generate as an output theencoded video bitstream.

The video stream may include a plurality of frames, wherein each frameis divided into blocks of a certain size that are either intra or intercoded. The blocks of for example the first frame of the video stream areintra coded by means of an intra prediction unit 154. An intra frame iscoded using only the information within the same frame, so that it canbe independently decoded and it can provide an entry point in thebitstream for random access. Blocks of other frames of the video streammay be inter coded by means of an inter prediction unit 144: informationfrom previously coded frames (reference frames) is used to reduce thetemporal redundancy, so that each block of an inter-coded frame ispredicted from a block in a reference frame. A mode selection unit 160is configured to select whether a block of a frame is to be processed bythe intra prediction unit 154 or the inter prediction unit 144. Thismode selection unit 160 also controls the parameters of intra or interprediction. In order to enable refreshing of the image information,intra-coded blocks may be provided within inter-coded frames. Moreover,intra-frames which contain only intra-coded blocks may be regularlyinserted into the video sequence in order to provide entry points fordecoding, i.e. points where the decoder can start decoding withouthaving information from the previously coded frames.

The intra estimation unit 152 and the intra prediction unit 154 areunits which perform the intra prediction. In particular, the intraestimation unit 152 may derive the prediction mode based also on theknowledge of the original image while intra prediction unit 154 providesthe corresponding predictor, i.e. samples predicted using the selectedprediction mode, for the difference coding. For performing spatial ortemporal prediction, the coded blocks may be further processed by aninverse quantization unit 110, and an inverse transform unit 112. Afterreconstruction of the block a loop filtering unit 120 is applied tofurther improve the quality of the decoded image. The filtered blocksthen form the reference frames that are then stored in a decoded picturebuffer 130. Such decoding loop (decoder) at the encoder side providesthe advantage of producing reference frames which are the same as thereference pictures reconstructed at the decoder side. Accordingly, theencoder and decoder side operate in a corresponding manner. The term“reconstruction” here refers to obtaining the reconstructed block byadding to the decoded residual block the prediction block.

The inter estimation unit 142 receives as an input a block of a currentframe or picture to be inter coded and one or several reference framesfrom the decoded picture buffer 130. Motion estimation is performed bythe inter estimation unit 142 whereas motion compensation is applied bythe inter prediction unit 144. The motion estimation is used to obtain amotion vector and a reference frame based on certain cost function, forinstance using also the original image to be coded. For example, themotion estimation unit 142 may provide initial motion vector estimation.The initial motion vector may then be signaled within the bitstream inform of the vector directly or as an index referring to a motion vectorcandidate within a list of candidates constructed based on apredetermined rule in the same way at the encoder and the decoder. Themotion compensation then derives a predictor of the current block as atranslation of a block co-located with the current block in thereference frame to the reference block in the reference frame, i.e. by amotion vector. The inter prediction unit 144 outputs the predictionblock for the current block, wherein said prediction block minimizes thecost function. For instance, the cost function may be a differencebetween the current block to be coded and its prediction block, i.e. thecost function minimizes the residual block. The minimization of theresidual block is based e.g. on calculating a sum of absolutedifferences (SAD) between all pixels (samples) of the current block andthe candidate block in the candidate reference picture. However, ingeneral, any other similarity metric may be employed, such as meansquare error (MSE) or structural similarity metric (SSIM).

However, cost-function may also be the number of bits necessary to codesuch inter-block and/or distortion resulting from such coding. Thus, therate-distortion optimization procedure may be used to decide on themotion vector selection and/or in general on the encoding parameterssuch as whether to use inter or intra prediction for a block and withwhich settings.

The intra estimation unit 152 and intra prediction unit 154 receive asan input a block of a current frame or picture to be intra coded and oneor several reference samples from an already reconstructed area of thecurrent frame. The intra prediction then describes pixels of a currentblock of the current frame in terms of a function of reference samplesof the current frame. The intra prediction unit 154 outputs a predictionblock for the current block, wherein said prediction blockadvantageously minimizes the difference between the current block to becoded and its prediction block, i.e., it minimizes the residual block.The minimization of the residual block can be based e.g. on arate-distortion optimization procedure. In particular, the predictionblock is obtained as a directional interpolation of the referencesamples. The direction may be determined by the rate-distortionoptimization and/or by calculating a similarity measure as mentionedabove in connection with inter-prediction.

The inter estimation unit 142 receives as an input a block or a moreuniversal-formed image sample of a current frame or picture to be intercoded and two or more already decoded pictures 231. The inter predictionthen describes a current image sample of the current frame in terms ofmotion vectors to reference image samples of the reference pictures. Theinter prediction unit 142 outputs one or more motion vectors for thecurrent image sample, wherein said reference image samples pointed to bythe motion vectors advantageously minimize the difference between thecurrent image sample to be coded and its reference image samples, i.e.,it minimizes the residual image sample. The predictor for the currentblock is then provided by the inter prediction unit 144 for thedifference coding.

The difference between the current block and its prediction, i.e. theresidual block 105, is then transformed by the transform unit 106. Thetransform coefficients 107 are quantized by the quantization unit 108and entropy coded by the entropy encoding unit 170. The thus generatedencoded picture data 171, i.e. encoded video bitstream, comprises intracoded blocks and inter coded blocks and the corresponding signaling(such as the mode indication, indication of the motion vector, and/orintra-prediction direction). The transform unit 106 may apply a lineartransformation such as a Fourier or Discrete Cosine Transformation(DFT/FFT or DCT). Such transformation into the spatial frequency domainprovides the advantage that the resulting coefficients 107 havetypically higher values in the lower frequencies. Thus, after aneffective coefficient scanning (such as zig-zag), and quantization, theresulting sequence of values has typically some larger values at thebeginning and ends with a run of zeros. This enables further efficientcoding. Quantization unit 108 performs the actual lossy compression byreducing the resolution of the coefficient values. The entropy codingunit 170 then assigns to coefficient values binary codewords to producea bitstream. The entropy coding unit 170 also codes the signalinginformation (not shown in FIG. 1).

FIG. 2 shows a video decoder 200. The video decoder 200 comprisesparticularly a decoded picture buffer 230, an inter prediction unit 244and an intra prediction unit 254, which is a block prediction unit. Thedecoded picture buffer 230 is configured to store at least one (foruni-prediction) or at least two (for bi-prediction) reference framesreconstructed from the encoded video bitstream, said reference framesbeing different from a current frame (currently decoded frame) of theencoded video bitstream. The intra prediction unit 254 is configured togenerate a prediction block, which is an estimate of the block to bedecoded. The intra prediction unit 254 is configured to generate thisprediction based on reference samples that are obtained from thereconstructed block 215 or buffer 216.

The decoder 200 is configured to decode the encoded video bitstreamgenerated by the video encoder 100, and preferably both the decoder 200and the encoder 100 generate identical predictions for the respectiveblock to be encoded/decoded. The features of the decoded picture buffer230, reconstructed block 215, buffer 216 and the intra prediction unit254 are similar to the features of the decoded picture buffer 130,reconstructed block 115, buffer 116 and the intra prediction unit 154 ofFIG. 1.

The video decoder 200 comprises further units that are also present inthe video encoder 100 like e.g. an inverse quantization unit 210, aninverse transform unit 212, and a loop filtering unit 220, whichrespectively correspond to the inverse quantization unit 110, theinverse transform unit 112, and the loop filtering unit 120 of the videocoder 100.

An entropy decoding unit 204 is configured to decode the receivedencoded video bitstream and to correspondingly obtain quantized residualtransform coefficients 209 and signaling information. The quantizedresidual transform coefficients 209 are fed to the inverse quantizationunit 210 and an inverse transform unit 212 to generate a residual block.The residual block is added to a prediction block 265 and the additionis fed to the loop filtering unit 220 to obtain the decoded video.Frames of the decoded video can be stored in the decoded picture buffer230 and serve as a decoded picture 231 for inter prediction.

Generally, the intra prediction units 154 and 254 of FIGS. 1 and 2 canuse reference samples from an already encoded area to generateprediction signals for blocks that need to be encoded or need to bedecoded.

The entropy decoding unit 204 receives as its input the encodedbitstream 171. In general, the bitstream is at first parsed, i.e. thesignaling parameters and the residuals are extracted from the bitstream.Typically, the syntax and semantic of the bitstream is defined by astandard so that the encoders and decoders may work in an interoperablemanner. As described in the above Background section, the encodedbitstream does not only include the prediction residuals. In case ofmotion compensated prediction, a motion vector indication is also codedin the bitstream and parsed therefrom at the decoder. The motion vectorindication may be given by means of a reference picture in which themotion vector is provided and by means of the motion vector coordinates.So far, coding the complete motion vectors was considered. However, alsoonly the difference between the current motion vector and the previousmotion vector in the bitstream may be encoded. This approach allowsexploiting the redundancy between motion vectors of neighboring blocks.

In order to efficiently code the reference picture, H.265 codec (ITU-T,H265, Series H: Audiovisual and multimedia systems: High Efficient VideoCoding) provides a list of reference pictures assigning to list indicesrespective reference frames. The reference frame is then signaled in thebitstream by including therein the corresponding assigned list index.Such list may be defined in the standard or signaled at the beginning ofthe video or a set of a number of frames. It is noted that in H.265there are two lists of reference pictures defined, called L0 and L1. Thereference picture is then signaled in the bitstream by indicating thelist (L0 or L1) and indicating an index in that list associated with thedesired reference picture. Providing two or more lists may haveadvantages for better compression. For instance, L0 may be used for bothuni-directionally inter-predicted slices and bi-directionallyinter-predicted slices while L1 may only be used for bi-directionallyinter-predicted slices. However, in general the present disclosure isnot limited to any content of the L0 and L1 lists.

The lists L0 and L1 may be defined in the standard and fixed. However,more flexibility in coding/decoding may be achieved by signaling them atthe beginning of the video sequence. Accordingly, the encoder mayconfigure the lists L0 and L1 with particular reference pictures orderedaccording to the index. The L0 and L1 lists may have the same fixedsize. There may be more than two lists in general. The motion vector maybe signaled directly by the coordinates in the reference picture.Alternatively, as also specified in H.265, a list of candidate motionvectors may be constructed and an index associated in the list with theparticular motion vector can be transmitted.

Motion vectors of the current block are usually correlated with themotion vectors of neighboring blocks in the current picture or in theearlier coded pictures. This is because neighboring blocks are likely tocorrespond to the same moving object with similar motion and the motionof the object is not likely to change abruptly over time. Consequently,using the motion vectors in neighboring blocks as predictors reduces thesize of the signaled motion vector difference. The Motion VectorPredictors (MVPs) are usually derived from already encoded/decodedmotion vectors from spatial neighboring blocks or from temporallyneighboring or co-located blocks in the reference picture. In H.264/AVC,this is done by doing a component wise median of three spatiallyneighboring motion vectors. Using this approach, no signaling of thepredictor is required. Temporal MVPs from a co-located block in thereference picture are only considered in the so called temporal directmode of H.264/AVC. The H.264/AVC direct modes are also used to deriveother motion data than the motion vectors. Hence, they relate more tothe block merging concept in HEVC. In HEVC, the approach of implicitlyderiving the MVP was replaced by a technique known as motion vectorcompetition, which explicitly signals which MVP from a list of MVPs, isused for motion vector derivation. The variable coding quad-tree blockstructure in HEVC can result in one block having several neighboringblocks with motion vectors as potential MVP candidates. Taking the leftneighbor as an example, in the worst case a 64×64 luma prediction blockcould have 16 4×4 luma prediction blocks to the left when a 64×64 lumacoding tree block is not further split and the left one is split to themaximum depth.

Advanced Motion Vector Prediction (AMVP) was introduced to modify motionvector competition to account for such a flexible block structure.During the development of HEVC, the initial AMVP design wassignificantly simplified to provide a good trade-off between codingefficiency and an implementation friendly design. The initial design ofAMVP included five MVPs from three different classes of predictors:three motion vectors from spatial neighbors, the median of the threespatial predictors and a scaled motion vector from a co-located,temporally neighboring block. Furthermore, the list of predictors wasmodified by reordering to place the most probable motion predictor inthe first position and by removing redundant candidates to assureminimal signaling overhead. The final design of the AMVP candidate listconstruction includes the following two MVP candidates: a) up to twospatial candidate MVPs that are derived from five spatial neighboringblocks; b) one temporal candidate MVPs derived from two temporal,co-located blocks when both spatial candidate MVPs are not available orthey are identical; and c) zero motion vectors when the spatial, thetemporal or both candidates are not available. Details on motion vectordetermination can be found in the book by V. Sze et al (Ed.), HighEfficiency Video Coding (HEVC): Algorithms and Architectures, Springer,2014, in particular in Chapter 5, incorporated herein by reference.

In order to further improve motion vector estimation without furtherincrease in signaling overhead, it may be beneficial to further refinethe motion vectors derived at the encoder side and provided in thebitstream. The motion vector refinement may be performed at the decoderwithout assistance from the encoder. The encoder in its decoder loop mayemploy the same refinement to obtain corresponding motion vectors.Motion vector refinement is performed in a search space which includesinteger pixel positions and fractional pixel positions of a referencepicture. For example, the fractional pixel positions may be half-pixelpositions or quarter-pixel or further fractional positions. Thefractional pixel positions may be obtained from the integer (full-pixel)positions by interpolation such as bi-linear interpolation.

In a bi-prediction of current block, two prediction blocks obtainedusing the respective first motion vector of list L0 and the secondmotion vector of list L1, are combined to a single prediction signal,which can provide a better adaptation to the original signal thanuni-prediction, resulting in less residual information and possibly amore efficient compression.

Since at the decoder, the current block is not available since it isbeing decoded, for the purpose of motion vector refinement, a templateis used, which is an estimate of the current block and which isconstructed based on the already processed (i.e. coded at the encoderside and decoded at the decoder side) image portions.

First, an estimate of the first motion vector MV0 and an estimate of thesecond motion vector MV1 are received as input at the decoder 200. Atthe encoder side 100, the motion vector estimates MV0 and MV1 may beobtained by block matching and/or by search in a list of candidates(such as merge list) formed by motion vectors of the blocks neighboringto the current block (in the same picture or in adjacent pictures). MV0and MV1 are then advantageously signaled to the decoder side within thebitstream. However, it is noted that in general, also the firstdetermination stage at the encoder could be performed by templatematching which would provide the advantage of reducing signalingoverhead.

At the decoder side 200, the motion vectors MV0 and MV1 areadvantageously obtained based on information in the bitstream. The MV0and MV1 are either directly signaled, or differentially signaled, and/oran index in the list of motion vector (merge list) is signaled. However,the present disclosure is not limited to signaling motion vectors in thebitstream. Rather, the motion vector may be determined by templatematching already in the first stage, correspondingly to the operation ofthe encoder. The template matching of the first stage (motion vectorderivation) may be performed based on a search space different from thesearch space of the second, refinement stage. In particular, therefinement may be performed on a search space with higher resolution(i.e. shorter distance between the search positions).

An indication of the two reference pictures RefPic0 and RefPic1, towhich respective MV0 and MV1 point, are provided to the decoder as well.The reference pictures are stored in the decoded picture buffer at theencoder and decoder side as a result of previous processing, i.e.respective encoding and decoding. One of these reference pictures isselected for motion vector refinement by search. A reference pictureselection unit of the apparatus for the determination of motion vectorsis configured to select the first reference picture to which MV0 pointsand the second reference picture to which MV1 points. Following theselection, the reference picture selection unit determines whether thefirst reference picture or the second reference picture is used forperforming of motion vector refinement. For performing motion vectorrefinement, the search region in the first reference picture is definedaround the candidate position to which motion vector MV0 points. Thecandidate search space positions within the search region are analyzedto find a block most similar to a template block by performing templatematching within the search space and determining a similarity metricsuch as the sum of absolute differences (SAD). The positions of thesearch space denote the positions on which the top left corner of thetemplate is matched. As already mentioned above, the top left corner isa mere convention and any point of the search space such as the centralpoint can in general be used to denote the matching position.

According to the above mentioned document JVET-D0029, the decoder-sidemotion vector refinement (DMVR) has as an input the initial motionvectors MV0 and MV1 which point into two respective reference picturesRefPict0 and RefPict1. These initial motion vectors are used fordetermining the respective search spaces in the RefPict0 and RefPict1.Moreover, using the motion vectors MV0 and MV1, a template isconstructed based on the respective blocks (of samples) A and B pointedto by MV0 and MV1 as follows:

Template=function((Block A,Block B)).

The function may be sample clipping operation in combination withsample-wise weighted summation. The template is then used to performtemplate matching in the search spaces determined based on MV0 and MV1in the respective reference pictures 0 and 1. The cost function fordetermining the best template match in the respective search spaces isSAD(Template, Block candA′), where block candA′ is the candidate codingblock which is pointed by the candidate MV in the search space spannedon a position given by the MV0. FIG. 3 illustrates the determination ofthe best matching block A′ and the resulting refined motion vector MV0′.Correspondingly, the same template is used to find best matching blockB′ and the corresponding motion vector MV1′ which points to block B′ asshown in FIG. 3. In other words, after the template is constructed basedon the block A and B pointed to by the initial motion vectors MV0 andMV1, the refined motion vectors MV0′ and MV1′ are found via search onRefPic0 and RefPic1 with the template.

Motion vector derivation techniques are sometimes also referred to asframe rate up-conversion (FRUC). The initial motion vectors MV0 and MV1may generally be indicated in the bitstream to ensure that encoder anddecoder may use the same initial point for motion vector refinement.Alternatively, the initial motion vectors may be obtained by providing alist of initial candidates including one or more initial candidates. Foreach of them a refined motion vector is determined and at the end, therefined motion vector minimizing the cost function is selected.

It is further noted that the present invention is not limited to thetemplate matching as described above with reference to FIG. 3. FIG. 4illustrates an alternative template matching which is also applicablefor uni-prediction. Details can be found in document JVET-A1001, inparticular in Section “2.4.6. Pattern matched motion vector derivation”of document JVET-A1001 which is titled “Algorithm Description of JointExploration Test Model 1”, by Jianle Chen et. al. and which isaccessible at: http://phenix.it-sudparis.eu/jvet/. The template in thistemplate matching approach is determined as samples adjacent to thecurrent bock in the current frame. As shown in FIG. 1, the alreadyreconstructed samples adjacent to the top and left boundary of thecurrent block may be taken, referred to as “L-shaped template”.

FIG. 5 illustrates another type of motion vector derivation which mayalso be used. The input to the motion vector derivation process is aflag that indicates whether or not the motion vector derivation isapplied. Implicitly, another input to the derivation process is themotion vector of a neighboring (temporally or spatially) previouslycoded/reconstructed block. The motion vectors of a plurality ofneighboring blocks are used as candidates for the initial search step ofmotion vector derivation. The output of the process is MV0′ (possiblyalso MV1′, if bi-prediction is used) and the corresponding referencepicture indices refPict0 and possibly refPict1 respectively. The motionvector refinement stage then includes the template matching as describedabove. After finding the refined one (uni-prediction) or more(bi-prediction/multi-frame prediction) motion vectors, the predictor ofthe current block is constructed (for bi/multi-prediction by weightedsample prediction, otherwise by referring to the samples pointed to byMV refined).

The present invention is not limited to the 2 template matching methodsdescribed above. As an example a third template matching method which iscalled bilateral matching (also described in the document JVET-A1001),can also be used for motion vector refinement and the invention appliessimilarly. According to bilateral matching, best match between twoblocks along the motion trajectory of the current block in two differentreference pictures is searched. Under the assumption of continuousmotion trajectory, the motion vectors MV0 and MV1 pointing to the tworeference blocks shall be proportional to the temporal distances, i.e.,TD0 and TD1, between the current picture and the two reference pictures.In bilateral matching a cost function such as SAD(Block cand0′, Blockcand1′) might be used where Block cand0′ is pointed by MV0 and Blockcand1′ is pointed by MV1.

According to an embodiment of the invention, an apparatus is providedfor determination of a motion vector for a prediction block, theapparatus including a processing circuitry. The processing circuitry isconfigured to obtain an initial motion vector and a template for theprediction block and determine a refinement of the initial motion vectorby template matching with said template in a search space. Said searchspace is located on a position given by the initial motion vector andincludes one or more fractional sample positions, wherein each of thefractional sample positions belonging to the search space is obtained byinterpolation filtering with a filter of a predefined tap-size assessinginteger samples only within a window, said window being formed byinteger samples accessible for the template matching in said searchspace.

The processing circuitry 600 is illustrated in FIG. 6. The processingcircuitry may include any hardware and the configuration may beimplemented by any kind of programming or hardware design of acombination of both. For instance, the processing circuitry may beformed by a single processor such as general purpose processor with thecorresponding software implementing the above steps. On the other hand,the processing circuitry may be implemented by a specialized hardwaresuch as an ASIC (Application-Specific Integrated Circuit) or FPGA(Field-Programmable Gate Array) of a DSP (Digital Signal Processor) orthe like.

The processing circuitry may include one or more of the above mentionedhardware components interconnected for performing the above motionvector derivation. The processing circuitry 600 includes computationlogic which implements two functionalities: obtaining the initial motionvector (or a plurality of initial motion vectors if bi-/multi-predictionis used) and template 610 and motion vector refinement 620. These twofunctionalities may be implemented on the same piece of hardware or maybe performed by separate units of hardware such as initial motion vectorand a template determination unit 610 and motion vector refinement unit620. The processing circuitry 600 may be communicatively connected to anexternal memory 650 in which the reconstructed reference picture samplesare stored. Moreover, the processing circuitry 600 may further includean internal memory 640 which buffers the samples in a window transferredfrom the external memory and used for the motion vector determinationfor the currently processed block. The processing circuitry may beembodied on a single chip as an integrated circuit.

It is noted that the processing circuitry may implement furtherfunctions of the encoder and/or decoder described with reference toFIGS. 1 and 2. The internal memory may be an on-chip memory such as acache or a line memory. Chip memory is advantageously implemented on theencoder/decoder chip to speed up computations. Since the size of thechip is limited, the on-chip memory is usually small. On the other hand,the external memory can be very large in size, however the access toexternal memory consumes more energy and the access is much slower.Usually the all necessary information is retrieved from the externalmemory to on-chip memory before the computations are performed. Worstcase external memory access (or bandwidth that needs to be provisionedwhen designing the memory bus), denotes the largest possible amount ofmemory transfer between external memory and the chip, while decoding aframe or coding unit. The memory (especially the external memory) canusually only be accessed in predefined block units. In other words it isgenerally not possible to access a single pixel, instead a smallest unit(e.g. 8×8) must be accessed. The on-chip memory size is also animportant design consideration, as a larger on chip memory increases thecost.

In other words, the above mentioned apparatus may be an integratedcircuit further comprising: an internal memory embedded within theintegrated circuit and a memory access unit (interface) for fetchinginteger samples located within said window from an external memory tothe internal memory.

The term “prediction block” employed above refers to the current blockwhich is to be predicted. It is a block within the image which may beobtained by subdividing the image into equally sized or differentlysized (for instance by hierarchical partitioning of a coding tree unit,CTU into the smaller units) blocks. The block may be square or moregenerally rectangular as these are the typical shapes also employed incurrent encoders/decoders. However, the present disclosure is notlimited by any size/shape of the block.

The apparatus including the processing circuit may be the encoder ordecoder or even an apparatus including such encoder or decoder, forinstance a recording device and/or a playback device.

Fractional sample positions are positions between the real picturesample positions obtained by reconstructing the reference picture whichwas coded as show in FIG. 1. Thus, the fractional positions must beobtained by interpolation based on the nearest integer positions.Details of an example interpolation filtering which is used by H.265 canbe found in Section “5.3 Fractional Sample Interpolation” of HighEfficiency Video Coding (HEVC) book by V. Sze et. al., Springer, 2014.

Interpolation filtering usually applies different filters in order togenerate different fractional pel (sample) positions. As an examplefollowing 1D separable filters are applied to generate quarter pel andhalf pel positions in H.265 video compression standard:

Phase Luma filter coefficients 1/4 [−1, 4, −10, 58, 17, −5, 1]/64 1/2[−1, 4, −11, 40, 40, −11, 4, −1]/64

As can be seen from the above table, the interpolation filteringrequires several samples around the fractional pel position,corresponding to the filter taps (number of coefficients in the table).Using the example filters above in order to generate a half pel position4 integer samples from left/top and right/bottom are required. It shouldbe noted that the length of the interpolation filter is different forquarter pel sample positions (which is 7 tap) than the half pel samplepositions (which is 8 tap).

In some embodiments of the invention, the interpolation filter of apredefined tap-size assesses integer samples only within a window givenby integer samples accessible for the template matching in said searchspace. The window might include much more samples than the ones actuallyused in computations of a certain prediction block. This is due to thefact that the refinement search operation is usually implemented using afast search method (as opposed to the brute force search method),according to which some of the samples are not evaluated depending onthe gradual progression of the search operation. As a result the numberof template matching iterations as well as the samples that are used incomputations for refinement search operation might change for eachprediction block.

The present disclosure sets the upper limits (territorial boundary) forthe integer samples that can be used during the refinement searchoperation, considering that the interpolation filtering needs to beapplied for fractional sample positions. This corresponds to the term“integer samples accessible for the template matching”. Which samplesare actually accessed depends on the way of forming the search space aswill be exemplified in the following.

FIG. 7 illustrates a coding block (prediction block) and thecorresponding samples of the window. It is noted that the samples shownin FIG. 7 are reference picture samples and the coding block here isactually a block corresponding in size and position to the current blockin the current frame for which the motion vector is to be derived in thereference picture. Thus, in fact, the coding block in FIG. 7 is in facta block co-located to the block for which the predictor is searched.However, for the simplicity reason, this block is referred as “codingblock” in the following.

In this example, unrefined motion vector MV0 points to an integer sampleposition (The initial motion vector can point to a fractional sampleposition, integer sample position is selected only for ease ofdepiction). The motion vector refinement search granularity is 1 integersample, meaning that since the starting point is an integer sample, onlyinteger sample points are searched. The search is performed, in thisexample, in a gradually developing search space. This means that thesearch space is in each iteration advanced by adding new searchpositions depending on the best direction in terms of cost function forthe previously tested positions.

Such approach is illustrated in a simplified manner in FIG. 8. In FIG.8, the initial motion vector pointed to the center point 810. The searchspace is gradually constructed around the initial motion vectorposition. In the first step, four positions immediately adjacent on thetop, bottom, left and right to the position 810 pointed to by theinitial motion vector as well as the position 810 pointed to by theinitial motion vector are tested. Based on the direction which resultsin a lowest cost function among the tested five points, furtherpositions to be tested are added to the search space. In this example,the lowest cost function could be seen in the right point and so thesearch space was extended by three further points in the horizontalright direction in the second step. In the second step the lowest costfunction could be seen in right point (with respect to the lowest costpoint of the first step), resulting in a further extension of the searchspace by three points in the horizontal right direction. In the thirdstep the lowest cost function is observed again in the right point withrespect to the lowest cost point of step 2 and results in the extensionof the search space by three more points in the horizontal rightdirection. According to the example in FIG. 8, three more steps areperformed in the top, top and right directions in that order. In theexample a diamond shaped pattern (consisting of 5 search points) is usedfor each iteration and the search space is extended in order to completethe missing search points at each step.

In each iteration of the search space determination, the search spacemay grow by one or more integer sample position. Returning now to FIG. 7in the example of which the maximum number of search iterations is 4.Since the maximum number of 4 iterations are possible, all of thesamples depicted on the left need to be retrieved from the memory toperform the search operation, in case the gradual development of thesearch space goes to the left. Similarly, 4 samples extension to the topis needed. Thus, the search space is extended in both directions(left-right and top-bottom) since the refined MV can move in eitherdirection and the hardware implementations require that all of thesamples that might be required are fetched from external memory beforethe application of refinement search. If the search space develops inthe bottom or right direction, extension by 4 further samples isnecessary since the template matching with a template corresponding tothe size of the coding block (prediction block) will need to access someof those samples. Moreover, the corner samples (e.g. top-right) mustalso be fetched from the memory, since hardware implementationstypically cannot fetch irregular shapes (rectangular access is morefeasible).

It is noted that the above described iterative search space developmentis only exemplary and the rules and number of points to extend thesearch space in each iteration may differ, i.e. be specified in adifferent way.

FIG. 8 also shows a scenario which may occur due to the external memoryaccess rules described above. The number of samples that are fetchedfrom the external memory is much higher than the samples that areactually used in the computation step. Assuming that the template hereis only one sample large (for simplicity reason), the white circlesrepresent samples that are retrieved from the external memory and theshaded samples that are actually used. However, such redundancy isnecessary if the number of accesses to the external memory is to be keptlow since when the current block is started to be processed, theactually needed samples are not yet known.

It is noted that the search space may also be defined in a differentway, for instance as a stabile shape located at the position pointed toby the initial motion vector. The shape may be any shape such as square,rectangle, diamond, or the like.

FIG. 9 illustrates an example in which the search space may also includefractional samples. In FIGS. 7 and 8, the motion vector search wasperformed on integer samples resulting in the positions indicated bysolid-line larger dots included in the access window. If now the searchis performed on a sample that has half-pel resolution (smallersolid-line dot), in order to generate the fractional sample, depicted onthe right hand side, three more columns of samples need to be retrievedfrom the memory as well, assuming that the interpolation filter issymmetric and has eight taps. Moreover same must be applied on the leftside (extension by 3 columns of pixels) due to the fact that searchoperation is symmetric (can move iteratively to the left and right) sothat a fractional pixel may be located on the left side of the window.

As a result due to interpolation filtering the number of samplesnecessary to be retrieved from the memory is further increased,indicated by the dashed line now also included the dotted-line circlesrepresenting the positions added due to fractional interpolation.Similarly if one allows half per positions in the vertical direction tobe searched as well, the window of samples to be accessed from thememory needs to be extended in the vertical direction too (not shown inthe example of FIG. 9), on the top and bottom sides.

Window of memory access is defined as the rectangle that encloses all ofthe samples that need to be retrieved from the memory in order toperform the motion vector search for a prediction block (coding block).The window of memory access not only includes the actual samples thatare required, but also all of the remaining samples that have thepossibility of being accessed during the motion vector search operation.In the example of FIG. 9, the motion vector search moved to the right.But it could have been moved to the left direction as well, which is notknown beforehand. Accordingly, in order not to access the externalmemory several times, the window of memory access (or access window)includes all samples accessible by the respective processing.

FIG. 10 shows a window of memory access for motion vector refinement.Center point 1010 is the position pointed to by the non-refined inputmotion vector (initial motion vector obtained either from the bitstreamor by previously performed template matching or testing of thecandidates as described above). In order to avoid further increasing ofthe window size due to adding fractional positions to the search space,motion vector refinement is performed according to following rules:

-   -   A) A window of memory access for refinement is defined around        the non-refined initial motion vector coordinate (i.e. position        pointed to by the initial motion vector). The window identifies        the maximum number of pixel samples that need to be accessed        from the memory in order to perform motion vector refinement by        template matching in a search space.        -   1. In this example, for the sake of simplicity, the size of            the current block (coding block size) is 1×1 sample, but it            can be larger and it typically would be larger.        -   2. The window of memory access is defined as the extension            around the coding block, such as 4 samples from left/right            and 4 samples from top/bottom shown in the figure.    -   B) The fractional pixel coordinates are accessed for MV        refinement only if samples necessary for interpolation lie        inside the window of memory access.

Requirement B ensures that the access window defined by the samplesnecessary for motion vector refinement on integer samples is not furtherextended. The actual fractional samples accessible according to thisrule are given by the size and shape of the interpolation filter.Accordingly, in FIG. 10, assuming an interpolation filter with 6 taps,the dotted line indicates a region in which the fractional samples maybe located. However, it is noted that further fractional pixel positionsmay be allowable as will be shown with reference to FIG. 12. Inparticular, fractional positions which require only vertical or onlyhorizontal filtering which does not require extension beyond the accesswindow may still be used. Thus, limiting the fractional positions to thefractional sample window shown in FIG. 10 may be too limiting for someapplications.

In other words, according to an embodiment, the memory access windowincludes all samples that are accessible by the motion vector refinementperformed on integer samples and do not include samples that are notaccessible by motion vector refinement performed on integer samples.Thus, if fractional samples are used for motion vector refinement, theyare obtained in a manner which does not require additional samples.

In the example of FIG. 10, this is achieved by only allowing fractionalsamples which, for a predefined interpolation filter shape and size, donot require samples out of the access window. The dotted fractionalsample window extends within the access window. If T is the number ofinterpolation filter taps, then the fractional sample window border isdefined by integer samples in a distance 1020 of floor(T/2)−1 from theaccess window border samples. In particular, in this example T=6, T/2=3and the distance from the access window border sample to the fractionalwindow sample is T/2−1=2 integer samples.

However, it is noted that this determination of the fractional window isa mere example. In general, the window may have a different form andsize. The vertical and horizontal interpolation may be done by filterswith different sizes. Moreover, some fractional positions may requirefilter in both vertical and horizontal direction which may in general byseparable or non-separable.

Alternatively, the interpolation filter could be changed (e.g. number oftaps at least in one direction reduced) for the fractional positionsoutside the dotted window in FIG. 10. However, for implementationpurposes and for interpolation quality reasons, such solution may beless attractive.

The window for memory access may be defined in various ways. FIG. 11illustrates an example in which the memory access window is defined asextensions EXT on the left/right or up/down of the coding block(corresponding to the location of the coding block given by the initialmotion vector). The extension amounts may depend on the size and theshape of the coding or prediction block. In FIG. 11, the extension is 4samples long in each direction (top, bottom, left, right). However, itis noted that the EXT may also take different values for the differentdirections, depending on the block size (which may have different sizein vertical and horizontal direction) and/or the search space form andsize.

For instance, according to an example, the window is defined as Ninteger sample columns and M integer sample rows relative to theprediction block initial motion vector, at least one of N and M beingnon-zero integer values (both being integer, but one of them can bezero). In FIG. 11, the N and M are indicated but have the same size. Asmentioned above, N and M may have a different size. N and M are integersand at least one of them are non-zero. Taking parameters N and M and thetemplate form and size, the size of the access window can be determined.In particular, if the template has T1 rows and T2 columns, the size ofthe memory access window may be calculated as (N+T2+N) rows and (M+T1+M)columns. This is because the search can go N samples left or rightresulting in 2N samples horizontally and M samples up or down resultingin 2M samples vertically.

On the other hand, for specific approaches of search space constructionsas the one described with reference to FIGS. 7 and 8, the memory accesswindow can be defined in terms of maximum number of refinementiterations (search space construction iterations) and iteration stepsize (in terms of maximum sample distance achievable in each iteration),which can be later converted to maximum amount of displacement in left,right, up and down. Therefore the memory access window is defined as themaximum displacement in each direction. For instance, the 4 iterationsin which each iteration may advance the search space in maximum oneinteger sample position result in EXT=4.

In other words, according to this example, the processing circuitry isconfigured to determine the refinement of the initial motion vector bytemplate matching with said template in a search space which isiteratively extended in a direction given by one (or more) of more bestmatching positions of the search space in a most recent iteration, thewindow is defined by a predefined maximum number of the iterations.

It is noted that in general, the present disclosure is not limited toany particular shape or form or kind of determination of the searchspace. In another example, search space is a rectangular sub-window ofthe window such that all integer samples accessed for interpolationfiltering of each fractional sample in the sub-window are located withinsaid window for the interpolation filter with the predefined tap-size. Asimilar example has been already discussed above with reference to FIG.10. In FIG. 10, the search space is given by the 9×9 integer samples andfractional samples located within the region formed by 5×5 integersamples with the initial motion vector position in their center.

The definition of the memory access window may be relevant in order topossibly include the corresponding signaling parameter into thebitstream (for instance parameter EXT or parameters N and M). However,the memory access window size may also be defined in the standard orderivable on the basis of other coding parameters (such as templatesize, prediction block size, image resolution, etc.).

FIG. 12 illustrates an example with different fractional pixelpositions. For this example, it is assumed that the size of the templateis 1×1 samples (for simplicity) and 6 tap interpolation filter is usedfor each half-pel position. In the example, the search coordinates thatare searched are denoted by numbers 1-6 which indicate the order theyare checked, i.e. the order in which the template matching search isperformed. Positions 1 and 2 are half-pel position (meaning that theyare located in the middle between two integer sample positions, pel isan abbreviation for pixel and the term pixel is used interchangeablywith the term sample in this application). Positions 1 and 2 are checkedsince the necessary extension for interpolation filtering lies insidethe window of memory access (3 integer samples on the diagonal top-leftand 3 integer samples bottom-right from position 1; 3 integer samples tothe right and 3 integer samples to the left of position 2). Note thatfractional sample point 1 requires extension both in horizontal andvertical direction, both of which lie inside the window. Position 2 onlyrequires extension to the right and to the left.

Positions 3, 4 and 5 are integer sample (integer-pel) positions. Theycan be searched since no extension for interpolation filtering isnecessary. Fractional (half-pel) sample 6 can also be accessed sinceonly an extension in the vertical direction (by three integer positionsup and down respectively) is necessary which is still inside the window.No extension in the horizontal direction is necessary. Still, in theabove implementation fractional sample points are accessed only ifnecessary interpolation extension is within the memory access window.

In other words, according to an example, the interpolation filter is aone-dimensional filter assessing K either horizontal or vertical integersamples when the fractional position is located on a respectivehorizontal or vertical line of integer samples.

Such one-dimensional fractional positions (e.g. positions 2 and 6 inFIG. 12) located on a line between two horizontally or two verticallyadjacent integer positions require an extension for interpolation onlyin horizontal direction or only in vertical direction, i.e. are to befiltered only by a respective horizontal or vertical interpolationfilter. In order to be able to make use of as many fractional positionsas possible, in addition to the fractional positions allowed in theexample of FIG. 10, it may be advantageous to add furtherone-dimensional positions such as position 6 shown in FIG. 12.

In other words, the search space further includes fractional positionslocated outside the fractional sub-window (cf. dotted window of FIG. 10)either:

-   -   adjacent on the top or on the bottom of the sub-window and        located on the horizontal line of integer samples or    -   adjacent on the left or on the right hand side of the sub-window        and located on the vertical line of integer samples.

It is noted that some fractional samples might require more integersamples in a given direction, horizontal or vertical. This may be thecase if the predefined filter size is different to generate thatposition in the respective directions.

FIG. 13 illustrates an example of fractional half-pel positions 1 and 2which cannot be accessed. They are located outside the sub-window shownin FIG. 10. For this example, it is assumed that 6 tap interpolationfilter is used for half pel positions. The half-pel search points 1 and2 are not allowed to be searched, since horizontal or verticalinterpolation filtering requires samples that lie outside of the window.The integer sample positions needed by the horizontal filter to filterposition 1 and the vertical filter to filter position 2 are indicated bya dashed line in FIG. 13. As can be seen, dashed circles correspond tothe integer positions which are not within the memory access window.

In the above examples, the memory access window was defined so that nosample outside of the window is accessed (even for interpolationfiltering) during the motion vector refinement process. In other wordsmemory access window is the smallest window that encloses the samplesthat might need to be accessed for motion vector refinement andinterpolation. Moreover, the memory access window has been designedaccording to the samples necessary for motion vector refinement based oninteger sample positions. Then, only fractional positions are allowedwhich do not require further extension of such access window by furtherinteger positions.

It is noted that the above examples were provided for half-pelinterpolation. However, the present disclosure is not limited thereto.In general, any fractional position such as ¼, ⅛, or the like may beused, i.e. interpolated using the corresponding interpolation filter.

The processing circuitry described with reference to FIG. 6 may beemployed in an encoder and/or decoder as shown in FIGS. 1 and 2.

In particular, an encoding apparatus may be provided for encoding videoimages split to prediction blocks into a bitstream, the encodingapparatus comprising: the apparatus for determination of a motion vectorfor a prediction block as described above including the processingcircuitry; and an encoding circuitry for encoding difference between theprediction block and the predictor given by a prediction block in aposition specified by the determined motion vector and for generatingbitstream including the encoded difference and the initial motionvector.

Further units and functions of the encoder described above withreference to FIG. 1 may also be provided or implemented in theprocessing circuitry.

Correspondingly, a decoding apparatus may be provided for decoding froma bitstream video images split to prediction blocks, the decodingapparatus comprising: a parsing unit for parsing from the bitstream aninitial motion vector and an encoded difference between a predictionblock and a predictor given by a prediction block in a positionspecified by a refined motion vector; the apparatus for determination ofthe refined motion vector for the prediction block as described aboveincluding the processing circuitry; and a decoding circuitry forreconstructing the prediction block as a sum of the parsed differenceand the predictor given by the prediction block in the position based onby the refined motion vector. For example, the predictor may be directlygiven by the position of the refined motion vector. However, there maybe further processing steps of obtaining the motion vector of thecurrent prediction block which may further change the motion vector(such as filtering, clipping, further refinement or the like).

Further units and functions of the decoder described above withreference to FIG. 2 may also be provided or implemented in theprocessing circuitry.

Moreover, the embodiments of the invention were described from the pointof view of the apparatus with the processing circuitry to perform themotion vector refinement. However, the present disclosure is not limitedthereto but also provides the corresponding methods which include theprocessing steps corresponding to those for the performing of which theabove described processing circuitry is configured.

In particular, a method is provided for determination of a motion vectorfor a prediction block including the steps of: obtaining an initialmotion vector and a template for the prediction block; determining arefinement of the initial motion vector by template matching with saidtemplate in a search space, wherein said search space is located on aposition given by the initial motion vector and includes one or morefractional sample positions, wherein each of the fractional samplepositions belonging to the search space is obtained by interpolationfiltering with a filter of a predefined tap-size assessing integersamples only within a window, said window being formed by integersamples accessible for the template matching in said search space.

The taps corresponds to the filter coefficients. The tap-sizecorresponds to filter order. Here, it is assumed that the filter is alinear filter. In some examples, the filter may be symmetric, i.e.having symmetric coefficients. However, the present disclosure is notlimited to symmetric filters or linear filters or any kind of filters.In general, the fractional positions may be obtained in any way based onthe adjacent samples.

Moreover an encoding method is provided for encoding video images splitto prediction blocks into a bitstream, the encoding method comprisingthe steps of determining a motion vector for a prediction blockaccording to any of methods described above; as well as encodingdifference between the prediction block and the predictor given by aprediction block in a position based on the determined motion vector andfor generating bitstream including the encoded difference and theinitial motion vector.

The encoding method may further include steps described with referenceto functions of blocks in FIG. 1.

Still further, a decoding method is provided for decoding from abitstream video images split to prediction blocks, the decoding methodcomprising: parsing from the bitstream an initial motion vector and anencoded difference between a prediction block and a predictor given by aprediction block in a position specified by a refined motion vector;determining the refined motion vector for the prediction block accordingto any of methods mentioned above; and reconstructing the predictionblock as a sum of the parsed difference and the predictor given by theprediction block in the position specified by the refined motion vector.

The decoding method may further include steps described with referenceto functions of blocks in FIG. 2.

However, it is noted that FIGS. 1 and 2 are not to limit the presentdisclosure. They merely provide a non-limiting example of animplementation of present invention within the existing encoder and/ordecoder.

FIG. 14 shows an exemplary implementation of a method according to anembodiment. A function InterpolationFilterLength(C) returns the numberof additional samples necessary in the horizontal and verticaldirections in order to apply interpolation filtering. The number ofnecessary samples changes depending on:

-   -   Whether the search coordinate is integer pel, half pel, or        quarter pel position.    -   Whether horizontal, vertical or both of the interpolation        filters need to be applied to generate the search coordinate        sample.

The method starts in step 1430. In particular, the initial motion vectorposition is the first search space position C(x,y) to be tested. Thefunction InterpolationFilterLength(C) returns for this position thenumber of samples in the horizontal and vertical directions in order toapply interpolation filtering. If the sum of C(x,y) andInterpolationFilterLength(C(x,y)) exceeds the access window size definedby MAX (max_x, max_y), then the position is not used as a part of thesearch space. Instead, next search coordinate C(x, y) is selected instep 1440 to be tested (for instance, x or y or both are incremented,depending on the order in which the search is performed). If the testedposition in step 1430 does not require exceeding the access window, instep 1410 the template matching as a part of the motion vectorrefinement is performed for that position C(x,y). Then it is tested instep 1420, whether there are still search space positions left fortemplate matching. If not, the refinement is terminated. If yes, thenext coordinate is selected in the step 1440 and the condition of step1430 is evaluated for that new position. These steps are repeated.

As already described above, alternative possibilities exist to definethe allowed fractional positions (such as the window in FIG. 10,possibly extended by further fractional samples as shown in FIG. 12).Based thereon, a simpler condition may be formulated in step 1430 merelyevaluating whether the position C(x,y) belongs to the allowed window.For instance, the search is restricted to the integer search points andthe fractional points within a fractional search window encapsulated inthe memory access window as the one illustrated in FIG. 10.

The search space may include a rectangular search sub-window of thewindow, and the refinement of the initial motion vector may bedetermined by template matching with said template in the rectangularsearch sub-window such that the integer samples accessed forinterpolation filtering of each fractional sample in the searchsub-window are located within said window for the interpolation filterwith the predefined tap-size.

More precisely, the allowed integer and fractional positions may bedetermined based on the distance of the search point from the pointassociated to the initial non-refined motion vector. Specifically,search positions are allowed, which are at a distance P in the xdirection from the initial non refined motion vector and at a distance Rin the y direction from the initial non refined motion vector.Specifically, the memory access window is defined with respect to thepoint in the reference picture pointed by the initial non-refined motionvector. This is exemplified in FIG. 15, where the center point of thememory access window is a half-pel point between two integer pointsalong the horizontal axis. In the figure the memory access window isdefined as extensions in the x-direction (N) and in the y-direction (M),where N and M are integer numbers at least one of which is non-zero.According to a particular implementation a sub-window, i.e. sub-windowfor search points (or search window), is defined within the memoryaccess window, defined as extensions in the x-direction (P) and In they-direction (R), which include all the integer pel and fractional pelsearch points that are allowed to be searched by template matching. InFIG. 15, the numbers P and R are equal to 1 for illustration purposes.Accordingly if the distance of a search point to the center point isgreater than P or R, in the x- and y-direction respectively, the searchpoint is not included in the memory access window. In this specificexample, since fractional search points require access to additionalsamples, the memory access window defined by N and M encapsulates orincludes the secondary window. P and R can be real numbers describingthe distance in units of distance between 2 integer sample points inhorizontal and vertical direction. As an example if P and R are definedas P=1.5 and R=1.5, then a search point (integer or fractional) that isat a distance 1.5 in x-direction to the initial center point is allowedto be searched by motion vector refinement process. Moreover in the FIG.15, the extensions in the left-right directions and top-bottomdirections are defined to be equal, P and R respectively, which ingeneral might be unequal. In general all of the 4 extensions to theleft, top, right and bottom can be defined independently.

FIG. 16 describes a possible implementation of an iterative refinementprocess in a memory access window. According to FIG. 16, the refinementsearch is applied in an iterative manner, meaning that only up to Ksearch points are searched at each iteration. Firstly K search pointsare determined around the initial starting point or around the bestsearch point that is selected as a result of the previous iteration(1610). Secondly if all of the K search points are inside the memoryaccess window (1620), the refinement search operation is applied to theK search points. However if any one of the K points are outside of thememory access window, then the search iterations are terminated. Thirdlythe condition of maximum number of search iterations are checked (1630)and iterations are terminated if the current iteration exceeds themaximum allowed number of search iterations. Finally the refinementsearch is applied to K search points (1640) and the best point among theK search points is selected according to a matching cost function(1650). Application of 1640 and 1650 increases the iteration numberby 1. After 1650 the process is repeated using the best point which isthe output of 1650 as input to 1610. According to FIG. 16, the number Kwhich determines the number of search points that are searched duringone iteration defines the maximum number of search points for eachiteration. The number K and the pattern of the points that are searchedfor each iteration might be different, depending on the search strategythat is used. For example according to an example search strategy K=5search points (center, left, right, below and above) might be searchedin the first iteration whereas K=3 points (center, below-right,below-left) might be searched in the second iteration. The number K is anumber that is smaller than the total number of search points within thememory access window.

According to the particular implementation described by FIG. 16, if asingle search point among the K search points of an iteration is outsideof the memory access window, the search iterations are terminated. Theremight be other points in K search points that are inside the memoryaccess window, but since the iterations are terminated, those pointsinside the memory access window are also not searched. The purpose ofthe particular implementation is to reduce the number of searchiterations and at the same time guarantee that the search points thatfall outside of the memory access window are not searched.

According to 1620, checking whether a search point is inside the memoryaccess window can be performed by checking the distance of the searchpoint to the initial starting point. Therefore if the x-component of thedistance is greater than N or if the y-component of the distance isgreater than M, the search point is determined to be outside of thememory access window. In general N and M are integer numbers, at leastone of which is greater than 0.

The refinement of the initial motion vector may be determined bytemplate matching with said template in a search space which isiteratively extended in a direction given by one of more best matchingpositions of the search space in a most recent iteration, wherein theiteration is ended when at least one sample within the search space ofthe most recent iteration is outside the search sub-window.

FIG. 17 is a flow chart describing a possible iteration schemeapplicable to the search sub-window as described in FIG. 15. The flowchart of FIG. 17 is the same as the flow chart described in FIG. 16except for step 1720. According to step 1720 of FIG. 17, the decision toperform refinement search on the K search points is decided by checkingwhether all of the K points are inside the sub-window for search points.In other words, as described in FIG. 15, if the distance of any one ofthe K search points to the center point pointed by initial non-refinedmotion vector is greater than P or R, then the condition described in1720 evaluates as false and iterations are terminated.

The motion vector determination with memory window limitation asdescribed above can be implemented as a part of encoding and/or decodingof a video signal (motion picture). However, the motion vectordetermination may also be used for other purposes in image processingsuch as movement detection, movement analysis, or the like withoutlimitation to be employed for encoding/decoding.

The motion vector determination may be implemented as an apparatus. Suchapparatus may be a combination of a software and hardware. For example,the motion vector determination may be performed by a chip such as ageneral purpose processor, or a digital signal processor (DSP), or afield programmable gate array (FPGA), or the like. However, the presentinvention is not limited to implementation on a programmable hardware.It may be implemented on an application-specific integrated circuit(ASIC) or by a combination of the above mentioned hardware components.

The motion vector determination may also be implemented by programinstructions stored on a computer readable medium. The program, whenexecuted, causes the computer to perform the steps of the abovedescribed methods. The computer readable medium can be any medium onwhich the program is stored such as a DVD, CD, USB (flash) drive, harddisc, server storage available via a network, etc.

The encoder and/or decoder may be implemented in various devicesincluding a TV set, set top box, PC, tablet, smartphone, or the like,i.e. any recording, coding, transcoding, decoding or playback device. Itmay be a software or an app implementing the method steps and stored/runon a processor included in an electronic device as those mentionedabove.

Summarizing, the present disclosure relates to motion vector refinement.As a first step, an initial motion vector and a template for theprediction block are obtained. Then, the refinement of the initialmotion vector is determined by template matching with said template in asearch space. The search space is located on a position given by theinitial motion vector and includes one or more fractional samplepositions, wherein each of the fractional sample positions belonging tothe search space is obtained by interpolation filtering with a filter ofa predefined tap-size assessing integer samples only within a window,said window being formed by integer samples accessible for the templatematching in said search space.

1. An apparatus for determination of a motion vector for a blockincluding a processing circuitry configured to: obtain an initial motionvector and a template for the block; determine a refinement of theinitial motion vector by template matching with said template in asearch space, wherein said search space is located on a position givenby the initial motion vector and includes one or more fractional samplepositions, wherein each of the fractional sample positions belonging tothe search space is obtained by interpolation filtering with a filter ofa predefined tap-size assessing integer samples only within a window,said window being formed by integer samples accessible for the templatematching in said search space.
 2. The apparatus according to claim 1,wherein the window is defined as an extension on at least one of: bothleft and right; and both top and bottom of the block.
 3. The apparatusaccording to claim 1, wherein the window is defined around a positionpointed at by the initial motion vector and identifies a number ofsamples to be accessed for determining the refinement of the initialmotion vector.
 4. The apparatus according to claim 1, wherein the windowis defined as N integer sample columns and M integer sample rowsrelative to the block initial motion vector, at least one of N and Mbeing non-zero integer values.
 5. The apparatus according to claim 1,wherein the processing circuitry is configured to determine therefinement of the initial motion vector by template matching with saidtemplate in a search space which is iteratively extended in a directiongiven by one of more best matching positions of the search space in amost recent iteration, the window is defined by a predefined maximumnumber of the iterations.
 6. The apparatus according to claim 1, whereinthe search space includes a rectangular sub-window of the window suchthat all integer samples accessed for interpolation filtering of eachfractional sample in the sub-window are located within said window forthe interpolation filter with the predefined tap-size.
 7. The apparatusaccording to claim 1, wherein the search space includes a rectangularsearch sub-window of the window, wherein the refinement of the initialmotion vector is determined by template matching with said template inthe rectangular search sub-window such that the integer samples accessedfor interpolation filtering of each fractional sample in the searchsub-window are located within said window for the interpolation filterwith the predefined tap-size.
 8. The apparatus according to claim 7,wherein the processing circuitry is configured to determine therefinement of the initial motion vector by template matching with saidtemplate in a search space which is iteratively extended in a directiongiven by one of more best matching positions of the search space in amost recent iteration, wherein the iteration is ended when at least onesample within the search space of the most recent iteration is outsidethe search sub-window.
 9. The apparatus according to claim 6, whereinthe interpolation filter is a one-dimensional filter assessing K eitherhorizontal or vertical integer samples when the fractional position islocated on a respective horizontal or vertical line of integer samples.10. The apparatus according to claim 7, wherein the search space furtherincludes fractional positions located outside the sub-window either:adjacent on the top or on the bottom of the sub-window and located onthe horizontal line of integer samples or adjacent on the left or on theright hand side of the sub-window and located on the vertical line ofinteger samples.
 11. An encoding apparatus for encoding video imagessplit to blocks into a bitstream, the encoding apparatus comprising: theapparatus for determination of a motion vector for a block according toclaim 1; and an encoding circuitry for encoding a difference between theblock and the predictor given by a block in a position based on thedetermined motion vector and for generating a bitstream including theencoded difference and the initial motion vector.
 12. A decodingapparatus for decoding from a bitstream video images split to blocks,the decoding apparatus comprising: a parsing unit for parsing from thebitstream an initial motion vector and an encoded difference between ablock and a predictor given by a block in a position specified by arefined motion vector; the apparatus for determination of the refinedmotion vector for the block according to claim 1; and decoding circuitryfor reconstructing the block as a sum of the parsed difference and thepredictor given by the block in the position specified by the refinedmotion vector.
 13. A method for determination of a motion vector for ablock including the steps of: obtaining an initial motion vector and atemplate for the block; determining a refinement of the initial motionvector by template matching with said template in a search space,wherein said search space is located on a position given by the initialmotion vector and includes one or more fractional sample positions,wherein each of the fractional sample positions belonging to the searchspace is obtained by interpolation filtering with a filter of apredefined tap-size assessing integer samples only within a window, saidwindow being formed by integer samples accessible for the templatematching in said search space.
 14. The method according to claim 13,wherein the window is defined a as N integer sample columns and Minteger sample rows relative to the block initial motion vector, N and Mbeing non-zero integer values.
 15. The method according to claim 13,wherein the refinement of the initial motion vector is determined bytemplate matching with said template in a search space which isiteratively extended in a direction given by one of more best matchingpositions of the search space in a most recent iteration, the window isdefined by a predefined maximum number of the iterations.
 16. The methodaccording to claim 13, wherein the search space includes a rectangularsub-window of the window such that all integer samples accessed forinterpolation filtering of each fractional sample in the sub-window arelocated within said window for the interpolation filter with thepredefined tap-size.
 17. The method according to claim 13, wherein thesearch space includes a rectangular search sub-window of the window,wherein the refinement of the initial motion vector is determined bytemplate matching with said template in the rectangular searchsub-window such that the integer samples accessed for interpolationfiltering of each fractional sample in the search sub-window are locatedwithin said window for the interpolation filter with the predefinedtap-size.
 18. The method according to claim 17, wherein the refinementof the initial motion vector is determined by template matching withsaid template in a search space which is iteratively extended in adirection given by one of more best matching positions of the searchspace in a most recent iteration, wherein the iteration is ended when atleast one sample within the search space of the most recent iteration isoutside the search sub-window.
 19. The method according to claim 16,wherein the interpolation filter is a one-dimensional filter assessing Keither horizontal or vertical integer samples when the fractionalposition is located on a respective horizontal or vertical line ofinteger samples.
 20. The method according to claim 19, wherein thesearch space further includes fractional positions located outside thesub-window either: adjacent on the top or on the bottom of thesub-window and located on the horizontal line of integer samples oradjacent on the left or on the right hand side of the sub-window andlocated on the vertical line of integer samples.
 21. An encoding methodfor encoding video images split to blocks into a bitstream, the encodingmethod comprising: determining a motion vector for a block according toclaim 13; and encoding a difference between the block and the predictorgiven by a block in a position based on the determined motion vector andfor generating a bitstream including the encoded difference and theinitial motion vector.
 22. A decoding method for decoding from abitstream video images split to blocks, the decoding method comprising:parsing from the bitstream an initial motion vector and an encodeddifference between a block and a predictor given by a block in aposition specified by a refined motion vector; determining the refinedmotion vector for the block according to claim 13; reconstructing theblock as a sum of the parsed difference and the predictor given by theblock in the position specified by the refined motion vector.
 23. Anon-transitory computer readable medium storing instructions which whenexecuted on a processor cause the processor to perform the methodaccording to claim 13.